<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorator="layouts/layout">
<head>
    <link th:href="@{/javascripts/pagination/jquery.pagination.min.css}" rel="stylesheet"/>

</head>
<body>
<div layout:fragment="content">
    <div class="panel panel-flat">
        <div class="panel-body">
            <div class="table-responsive">
                <div class="datatable-scroll">
                    <table class="table" id="tbl-information-list">
                        <thead>
                        <tr>
                            <th class="text-center">标题</th>
                            <th class="text-center">文章分类</th>
                            <th class="text-center">创建时间</th>
                            <th class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- /page content -->
</body>
</html>
<script type="text/javascript" th:src="@{/javascripts/pagination/jquery.pagination.min.js}"></script>
<script type="text/javascript">
    $(function () {
        loadInformationPage(0);

    });

    function loadInformationPage(pageNum) {
        $.ajax({
            url: '/management_system/informationPageItems',
            type: 'POST',
            data: {pageNumber: pageNum, pageSize: 10, sortFields: []},
            dataType: 'HTML',
            success: function (data) {
                $("#tbl-information-list").find("tbody").html(data);

            },
            error: function (error) {
                console.log(error);
            }
        });
    }


    function deleteInformationById(informationId) {
        $.ajax({
            url: '/management_system/deleteInformationById',
            type: 'GET',
            data: {informationId: informationId},
            dataType: 'JSON',
            success: function (data) {
                if(data.code == 0){
                    showSuccessMessage("删除成功！");
                    loadInformationPage(0);
                }else{
                    showErrorMessage("删除失败！");
                }

            },
            error: function (error) {
                console.log(error);
                showErrorMessage("删除失败！");
            }
        });
    }
</script>

